﻿// See https://aka.ms/new-console-template for more information
using ConsoleMinio;
using System.Net.Mime;
using System.Security.AccessControl;

Console.WriteLine("Hello, World!");
var _minioClient = MinioHelper.UGetInstance();



//Stream stream = null;

//bool result = await _minioClient.UGetObjectAsync(@"public", @"images/2024/1/1.jpg", async Stream =>
//{
//   await Stream.CopyToAsync(stream);
//});

//if (result) Console.WriteLine("成功!");

//if(stream != null)
//{
//    var imgStreamCompress = ImageTools.CompressToMemoryFromWeb(stream, 200, 50, out decimal width, out decimal height);
//    var o2 = await _minioClient.UPutObjectAsync(@"public", @"images/2024/1/compress_1.jpg", imgStreamCompress, imgStreamCompress.Length, "image/jpeg");
//    if (o2) await Console.Out.WriteLineAsync("上传成功!");
//    else await Console.Out.WriteLineAsync("上传失败!====");
//}



#region No Problem

//await _minioClient.UGetObjectAsync("public", "images/2024/1/1.jpg", @"D:\迅雷下载\666.jpg");


//var list = await _minioClient.UListBuckets();
//if (list.Item1)
//{
//    var result = list.Item2;
//    foreach (var item in result.Buckets)
//    {
//        Console.WriteLine($"{item.Name},{item.CreationDate},{item.CreationDateDateTime}");
//    }
//}

//await _minioClient.UMakeBucket("zjtest");

//var result = await _minioClient.UBucketExists("public");
//if (result)
//{
//    Console.WriteLine("已存在");
//}
//else
//{
//    Console.WriteLine("不存在");
//}

//await _minioClient.URemoveBucket("zjtest");

#endregion